package com.example.sls.controller.social;

import com.example.sls.pojo.social.Posts;
import com.example.sls.service.intserfaces.social.PostsService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 动态表(Posts)表控制层
 *
 * @author 蓝江富
 * @since 2024-06-19 13:23:44
 */
@RestController
@RequestMapping("social/posts")
public class PostsController {
  @Autowired
  PostsService postsService;

  @GetMapping("queryById")
  Posts queryById(Integer id) {
    return postsService.queryById(id);
  }

  @GetMapping("queryAllByLimit")
  List<Posts> queryAllByLimit(Posts posts, Integer pageSize, Integer offset) {
    return postsService.queryAllByLimit(posts, pageSize, offset);
  }

  @GetMapping("count")
  long count() {
    return postsService.count();
  }

  @GetMapping("insert")
  int insert(Posts posts) {
    return postsService.insert(posts);
  }

  @GetMapping("update")
  int update(Posts posts) {
    return postsService.update(posts);
  }

  @GetMapping("deleteById")
  int deleteById(Integer id) {
    return postsService.deleteById(id);
  }
}

